<?php

/**
 * Ruta form base class.
 *
 * @method Ruta getObject() Returns the current form's model object
 *
 * @package    SistemaRutasEc
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseRutaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_ru'    => new sfWidgetFormInputHidden(),
      'id_co'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cooperativa'), 'add_empty' => false)),
      'salida'   => new sfWidgetFormInputText(),
      'llegada'  => new sfWidgetFormInputText(),
      'tipoRuta' => new sfWidgetFormInputText(),
      'activo'   => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id_ru'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_ru')), 'empty_value' => $this->getObject()->get('id_ru'), 'required' => false)),
      'id_co'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cooperativa'))),
      'salida'   => new sfValidatorString(array('max_length' => 255)),
      'llegada'  => new sfValidatorString(array('max_length' => 255)),
      'tipoRuta' => new sfValidatorInteger(),
      'activo'   => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ruta[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Ruta';
  }

}
